from pydantic import BaseModel, Field
from typing import Optional, List

from module_admin.entity.vo.menu_vo import CasdoorMenuForAdd
from module_admin.entity.vo.role_vo import CasdoorRoleForAdd


class UserLogin(BaseModel):
    user_name: str
    password: str
    captcha: Optional[str]
    session_id: Optional[str]
    login_info: Optional[dict]
    captcha_enabled: Optional[bool]
class CodeState(BaseModel):
    code: str
    state: str

class CasdoorToken(BaseModel):
    token: str

class Token(BaseModel):
    access_token: str
    token_type: str


class SmsCode(BaseModel):
    is_success: Optional[bool]
    sms_code: str
    session_id: str
    message: Optional[str]


class CasdoorLogin(BaseModel):
    """
    Casdoor用户信息
    """
    name: Optional[str] = Field(None, comment='用户账号-可变唯一')  # chouse
    groups: Optional[List[str]] = Field(None, comment='部门集合')
    roles: Optional[List[CasdoorRoleForAdd]] = Field(None, comment='角色集合')
    menus: Optional[List[CasdoorMenuForAdd]] = Field(None, comment='菜单集合')
